package com.zbbt.sportslottery.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.GestureDetector.OnGestureListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;

import com.zbbt.sportslottery.R;
import com.zbbt.sportslottery.app.App;
import com.zbbt.sportslottery.app.Constant;
import com.zbbt.sportslottery.util.AppUtil;
import com.zbbt.sportslottery.util.ToastUtil;

/**
 * 
 * @ClassName: AboutUsActivity
 * @Description: 关于我们
 * @author: yangwenquan
 * @date: 2015年1月14日 下午5:39:51
 * @version: V1.0
 */
public class AboutUsActivity extends SimpleBaseActivity {
	private TextView aboutText;
	private GestureDetector gestureDetector;

	@Override
	protected void onActivityCreated(Bundle savedInstanceState) {
		setContentView(R.layout.activity_about_us);
	}

	@Override
	protected void initView() {
		Intent intent=getIntent();
	    String title=intent.getStringExtra("Title");
//	    String summary=intent.getStringExtra("summary");
//	    String ShareTitle=intent.getStringExtra("ShareTitle");
//	    int newid=intent.getIntExtra("newid", 8);
//	    String type=intent.getStringExtra("type");
	    setTitle(title);
		aboutText = (TextView) findViewById(R.id.about_text);
		String text = AppUtil.getVersionName(context);
		aboutText.setText("福建体彩报:" + "V" + text);
		aboutText.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				ToastUtil.showLong(App.PARAM_SID);
			}
		});
		gestureDetector = new GestureDetector(context, gestureListener);
	}

	@Override
	public boolean dispatchTouchEvent(MotionEvent ev) {
		gestureDetector.onTouchEvent(ev);
		return super.dispatchTouchEvent(ev);
	}

	private OnGestureListener gestureListener = new OnGestureListener() {

		@Override
		public boolean onSingleTapUp(MotionEvent e) {
			// TODO Auto-generated method stub
			return false;
		}

		@Override
		public void onShowPress(MotionEvent e) {
			// TODO Auto-generated method stub

		}

		@Override
		public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
			// TODO Auto-generated method stub
			return false;
		}

		@Override
		public void onLongPress(MotionEvent e) {
			// TODO Auto-generated method stub

		}

		@Override
		public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
			boolean isX_Event = e2.getX() - e1.getX() > Constant.FLING_MIN_DISTANCE_X;
			boolean isY_Event = e2.getY() - e1.getY() > Constant.FLING_MIN_DISTANCE;
			if (isX_Event && isY_Event && velocityX > Constant.FLING_MIN_VELOCITY) {
				finish();
				overridePendingTransition(R.anim.push_right_out, R.anim.push_right_in);
			}
			return false;
		}

		@Override
		public boolean onDown(MotionEvent e) {
			// TODO Auto-generated method stub
			return false;
		}
	};

	@Override
	protected void setListener() {

	}

	@Override
	protected void onClickEvent(View v) {

	}

	@Override
	protected void initData() {

	}

}
